import os

def getLocal(path_,mlocal = []):
    if os.path.isfile(path_):
        mlocal.append(path_)
    elif not os.listdir(path_):
        pass
    else:
        for i in os.listdir(path_):
            pat = os.path.join(path_, i)
            getLocal(pat)
    return mlocal


def getSize(path_):
    mcount = 0
    for j in getLocal(path_):
        mcount += os.path.getsize(j)
    if mcount < 1024:
        return str(mcount)+"字节","{:,}".format(mcount)+"字节"
    elif mcount < 1024*1024:
        return str(round(mcount/1024,2))+"KB","{:,}".format(mcount)+"字节"
    else :
        return str(round(mcount/1024/1024,2))+"MB","{:,}".format(mcount)+"字节"


if __name__ == '__main__':
    arg1 = input("请输入地址：\n")
    print("文件夹大小为:%s(%s)" % (getSize(arg1)[0],getSize(arg1)[1]))